#ifndef DISPLAYTHREAD_H
#define DISPLAYTHREAD_H

#include <QObject>
#include "qcustomplot.h"
#include "header.h"
#include "jlog.h"
#include <QTimer>
#include <QDir>

class DisplayThread : public QObject
{
    Q_OBJECT
public:
    explicit DisplayThread(QObject *parent = NULL);
signals:
    void SendWaveData(QVector<double> *data, float *MaxValue);
    void SendSaveData(DateTimeInfo time, QVector<float>* data);
    void TrigDataTip();      // 触发提醒信号
    void SendNoistTestData(float *MaxValue);

public slots:
    void SampeleWaveCount(QVector<double> *data);

    void RcvTimeout();

    void NoiseTestSignal();

private:
    QVector<QCustomPlot*> WaveChannels;
    float MaxValue[CHANNELCOUNT];
    QVector<double> DisplayData[CHANNELCOUNT];
    QVector<float> DataBuf[CHANNELCOUNT];
    QVector<float> SaveBuf[CHANNELCOUNT];
    bool IsTrigged;
    DateTimeInfo SaveTime;
    int FreqTimeLen;
    bool IsSaving;
    QTimer RcvTimer;
    bool NoiseTest;
    float NoiseValue[CHANNELCOUNT];

    int GetRangeValue(float Value);
    int GetChMaxValue(QVector<double> data);
    int GetSampCnt(int Freq);
};

#endif // DISPLAYTHREAD_H
